package com.itheima.map;

import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

/*
Map的第二种遍历方式
entrySet()
Entry  getKey()  getValue()
 */
public class Demo04 {

    public static void main(String[] args) {
        Map<String,String> map = new TreeMap<>();
        map.put("马蓉","宋喆");
        map.put("都美竹","吴亦凡");
        map.put("小吉娜","吴亦凡");
        map.put("小璐","PGone");
        map.put("爽子","张恒");

        //获取所有的键值对组合   Set<Entry>
        //Map.Entry<String, String>
        Set<Map.Entry<String, String>> entries = map.entrySet();

        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry.getKey()+"===="+entry.getValue());
        }

    }


}
